#include <iostream>
#include <memory>

using namespace std;

class Foo : public std::enable_shared_from_this<Foo>
{
public:
    Foo() {}
    ~Foo() {}
    shared_ptr<Foo> getFoo()
    {
        return shared_from_this();
    }
};

void delint(int *ptr)
{
    cout << "del ptr int" << *ptr << endl;
    delete ptr;
    ptr = nullptr;
}

int main(int argc, char *argv[])
{
    //shared_ptr<int> pInt = make_shared<int>(new int(5), delint);
    shared_ptr<int> pI (new int(10), delint);
    pI.reset(new int(5), delint);
    return 0;
}
